# This file contains snippets that are always defined. I personally
# have snippets for signatures and often needed texts

# sligthly lower priority than everything else since specialized versions
# should overwrite. The user needs to adjust her priority in her snippets to
# ~-55 so that other filetypes will still overwrite.
priority -60
global !p

def write_docstring_args(arglist, snip):
	args = str(arglist).split(',')

	if len(args) > 1:
		c = 0
		for arg in args:
			if c == 0:
				snip.rv += arg
				c = 1
			else:
				snip += ' * @param [in] %s' % arg.strip()
	else:
		snip.rv = args[0]


endglobal

snippet mfun "Basic c++ doxygen function template" b
/**
 * @brief ${4:brief}
 *
 * @param [in] `!p write_docstring_args(t[3],snip)`
 *
 * @return ${5:OK?} 
 * 
 * @see ${6:FunctionSee} 
 */
${1:ReturnType} ${2:FunctionName}(${3:param})
{
  ${0:FunctionBody}
}
endsnippet

snippet mc "" b
/* ${0:comment} */
endsnippet

snippet mb "" b
/**
 * ${0:comment}
 */
endsnippet

snippet mm "" b
/**< ${0:comment} */
endsnippet

snippet mfile "Basic c++ doxygen file template" b
/**
 * @file      ${1:file}
 * @copyright (C) Copyright 2017, UT Technology Co., Ltd.
 * @brief     ${2:brief}
 * @author    ${3:caiwang213@qq.com}
 * @date      `date` 
 *
 * @note
 *  ${0:note} 
 */
endsnippet

snippet mclass "Basic c++ doxygen class template" b
/**
 * @class  ${1:class}
 * @brief  ${2:brief}
 * @author ${3:caiwang213@qq.com}
 * @date   `date` 
 *
 * @note
 *  ${0:note} 
 */
endsnippet

snippet logd "log4x template" b
LOGF_DEBUG(${1:key}, "${2:%s}", ${0:param});
endsnippet

snippet logi "log4x template" b
LOGF_INFO(${1:key}, "${2:%s}", ${0:param});
endsnippet

snippet logw "log4x template" b
LOGF_WARN(${1:key}, "${2:%s}", ${0:param});
endsnippet

snippet loge "log4x template" b
LOGF_ERROR(${1:key}, "${2:%s}", ${0:param});
endsnippet

snippet logf "log4x template" b
LOGF_FATAL(${1:key}, "${2:%s}", ${0:param});
endsnippet

# vim:ft=snippets:
